﻿using System;

namespace Zinnia.EF.Test
{
    public interface IZinnia
    {
        string Id { get; set; }
        double CreatedTimeStamp { get; set; }
    }

    public class ZinniaObject : IZinnia
    {
        private Type _DeclareType { get; set; }
        public ZinniaObject()
        {
            _DeclareType = this.GetType();
            Id = Guid.NewGuid().ToString();
            CreatedTimeStamp = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds;
        }

        public string Id { get; set; }
        public double CreatedTimeStamp { get; set; }

        public virtual string TableName()
        {
            return _DeclareType.FullName.Substring(_DeclareType.FullName.LastIndexOf('.') + 1);
        }
        public virtual string SchemaName()
        {
            return "dbo";
        }
    }   
}
